﻿
System.Gadget.onDock = CheckDockState;
System.Gadget.onUndock = CheckDockState;

function CheckDockState()
{
    System.Gadget.beginTransition();

    var oBody = document.body.style;
    var oBackground = document.getElementById("imgBackground");
    var oContent = document.getElementById("gadgetContent").style;
    
    if (System.Gadget.docked)
    {
        oBody.width = "130px";
        oBody.height = "117px";
        
        oBackground.src = "url(images/background.png)";

        oContent.width = "120px";
        oContent.height = "92px";
    }
    else
    {
        oBody.width = "260px";
        oBody.height = "234px";
        
        oBackground.src = "url(images/backgroundL.png)";    
        
        oContent.width = "250px";
        oContent.height = "210px";
    }
    System.Gadget.endTransition(System.Gadget.TransitionType.morph, 1);
}